#!/bin/bash
LANG=zh_CN.utf8;

INSTALL_DIR=/usr/local
if [ $# -eq 1 ]; then
	INSTALL_DIR=`readlink -f $1`
fi

mkdir -p ${INSTALL_DIR}

cp -rf ./bin ${INSTALL_DIR}
cp -rf ./share ${INSTALL_DIR}
cp -rf ./include ${INSTALL_DIR}
cp -rf ./lib ${INSTALL_DIR}

cd ${INSTALL_DIR}/lib
ln -s libtorrent-rasterbar.so.9.0.0 libtorrent-rasterbar.so.9
ln -s libtorrent-rasterbar.so.9.0.0 libtorrent-rasterbar.so

export LD_LIBRARY_PATH=${INSTALL_DIR}/lib:${LD_LIBRARY_PATH}
export PATH=${INSTALL_DIR}/bin:${PATH}
export QB419_INSTALL_PATH=${INSTALL_DIR}

echo -e "export LD_LIBRARY_PATH=${INSTALL_DIR}/lib:${LD_LIBRARY_PATH}\n" >> ~/.bashrc
echo -e "export PATH=${INSTALL_DIR}/bin:${PATH}\n" >> ~/.bashrc
echo -e "export QB419_INSTALL_PATH=${INSTALL_DIR}\n" >> ~/.bashrc

echo -e "Finished！The install path is :${INSTALL_DIR}.\n"